package com.yu.waterstation.app.moudles.student.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yu.waterstation.app.moudles.student.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface StudentMapper extends BaseMapper<Student> {
    /**
     * 解除微信绑定
     * @param id
     */
    @Update("update student set wx_openid = NULL, wx_avatar = NULL where id = #{id}")
    int unbindWeiXin(@Param("id") Integer id);

    /**
     * 删除openid
     * @param openid
     */
    @Update("update student set wx_openid = NULL where wx_openid = #{openid}")
    int deleteOpenid(@Param("openid") String openid);

    // 重置学生信息
    @Update("update student set college_id = NULL, address_id = NULL, student_no = NULL, reset_count = reset_count + 1 where id = #{param1}; ")
    int resetStudentInfo(Integer currentStudentId);
}
